import Mock from 'mockjs'

Mock.mock(RegExp('/getPageList' + ".*"), (req) => {
    let data = [
        {
            "id": 101,
            "name": "黎涛",
            "title": "风历还却"
        },
        {
            "id": 102,
            "name": "廖平",
            "title": "团难八"
        },
        {
            "id": 103,
            "name": "徐勇",
            "title": "元联位近来"
        },
        {
            "id": 104,
            "name": "黎桂英",
            "title": "问委器个把委"
        },
        {
            "id": 105,
            "name": "傅芳",
            "title": "比自压"
        },
        {
            "id": 106,
            "name": "段刚",
            "title": "查多指"
        },
        {
            "id": 107,
            "name": "姜芳",
            "title": "商快加研"
        },
        {
            "id": 108,
            "name": "曾静",
            "title": "进片情段劳"
        },
        {
            "id": 109,
            "name": "高桂英",
            "title": "备原效活"
        },
        {
            "id": 110,
            "name": "雷桂英",
            "title": "话车儿此"
        },
        {
            "id": 111,
            "name": "孟静",
            "title": "无积分该"
        },
        {
            "id": 112,
            "name": "龙刚",
            "title": "北确战议很拉"
        },
        {
            "id": 113,
            "name": "郑娜",
            "title": "层据备清"
        },
        {
            "id": 114,
            "name": "邓丽",
            "title": "根低工统"
        },
        {
            "id": 115,
            "name": "邵芳",
            "title": "音或再构"
        },
        {
            "id": 116,
            "name": "刘平",
            "title": "种面当研断进八"
        },
        {
            "id": 117,
            "name": "苏军",
            "title": "节位意"
        },
        {
            "id": 118,
            "name": "冯强",
            "title": "才第后增资住"
        },
        {
            "id": 119,
            "name": "周涛",
            "title": "流都义土约易"
        },
        {
            "id": 120,
            "name": "唐刚",
            "title": "广外边王团"
        },
        {
            "id": 121,
            "name": "康敏",
            "title": "教进完听家"
        },
        {
            "id": 122,
            "name": "薛明",
            "title": "采时深价验"
        },
        {
            "id": 123,
            "name": "郭敏",
            "title": "基边深需精作现"
        },
        {
            "id": 124,
            "name": "阎明",
            "title": "本县边者机计"
        },
        {
            "id": 125,
            "name": "常超",
            "title": "统放重设许连"
        },
        {
            "id": 126,
            "name": "郭霞",
            "title": "她话住发叫"
        },
        {
            "id": 127,
            "name": "于秀英",
            "title": "四思个特多集"
        },
        {
            "id": 128,
            "name": "张勇",
            "title": "千众总看并"
        },
        {
            "id": 129,
            "name": "郝涛",
            "title": "面改深气基议"
        },
        {
            "id": 130,
            "name": "黄杰",
            "title": "京命加量品认调"
        },
        {
            "id": 131,
            "name": "白平",
            "title": "因识每规率说却"
        },
        {
            "id": 132,
            "name": "蒋明",
            "title": "通统养期"
        },
        {
            "id": 133,
            "name": "邓敏",
            "title": "真商毛斗影"
        },
        {
            "id": 134,
            "name": "秦超",
            "title": "力验进低深说"
        },
        {
            "id": 135,
            "name": "袁静",
            "title": "儿较据按满做"
        },
        {
            "id": 136,
            "name": "史杰",
            "title": "特容变展土因"
        },
        {
            "id": 137,
            "name": "陆强",
            "title": "经近多中外除"
        },
        {
            "id": 138,
            "name": "钱杰",
            "title": "名心重"
        },
        {
            "id": 139,
            "name": "彭娟",
            "title": "数我却则"
        },
        {
            "id": 140,
            "name": "阎静",
            "title": "那场何"
        },
        {
            "id": 141,
            "name": "贾芳",
            "title": "完历史圆"
        },
        {
            "id": 142,
            "name": "马洋",
            "title": "法究法它"
        },
        {
            "id": 143,
            "name": "谢静",
            "title": "种酸难月"
        },
        {
            "id": 144,
            "name": "萧超",
            "title": "国是价东度到装"
        },
        {
            "id": 145,
            "name": "薛静",
            "title": "好自切角复常"
        },
        {
            "id": 146,
            "name": "朱芳",
            "title": "员的市门来金"
        },
        {
            "id": 147,
            "name": "王磊",
            "title": "县基究办市"
        },
        {
            "id": 148,
            "name": "方艳",
            "title": "万般自来越市"
        },
        {
            "id": 149,
            "name": "潘涛",
            "title": "也化十象活中"
        },
        {
            "id": 150,
            "name": "朱秀英",
            "title": "龙区安领"
        }
    ]
    let total = data.length
    let url = req.url.split('?')[1]
    let pageSize = url.split('&')[0].split('=')[1]
    let pageNum = url.split('&')[1].split('=')[1]

    let current = (pageNum - 1) * pageSize

    let res = data.splice(current, pageSize)

    return {
        res,
        total
    }
})

Mock.mock(RegExp('/getAppList' + ".*"), (req) => {
    let data = [
        {
            "id": 110,
            "name": "雷桂英",
            "title": "话车儿此"
        },
        {
            "id": 111,
            "name": "孟静",
            "title": "无积分该"
        },
        {
            "id": 112,
            "name": "龙刚",
            "title": "北确战议很拉"
        },
        {
            "id": 113,
            "name": "郑娜",
            "title": "层据备清"
        },
        {
            "id": 114,
            "name": "邓丽",
            "title": "根低工统"
        },
        {
            "id": 115,
            "name": "邵芳",
            "title": "音或再构"
        },
        {
            "id": 116,
            "name": "刘平",
            "title": "种面当研断进八"
        },
        {
            "id": 117,
            "name": "苏军",
            "title": "节位意"
        },
        {
            "id": 118,
            "name": "冯强",
            "title": "才第后增资住"
        },
        {
            "id": 119,
            "name": "周涛",
            "title": "流都义土约易"
        },
        {
            "id": 120,
            "name": "唐刚",
            "title": "广外边王团"
        },
        {
            "id": 121,
            "name": "康敏",
            "title": "教进完听家"
        },
        {
            "id": 122,
            "name": "薛明",
            "title": "采时深价验"
        },
        {
            "id": 123,
            "name": "郭敏",
            "title": "基边深需精作现"
        },
        {
            "id": 124,
            "name": "阎明",
            "title": "本县边者机计"
        },
        {
            "id": 125,
            "name": "常超",
            "title": "统放重设许连"
        },
        {
            "id": 126,
            "name": "郭霞",
            "title": "她话住发叫"
        },
        {
            "id": 127,
            "name": "于秀英",
            "title": "四思个特多集"
        },
        {
            "id": 128,
            "name": "张勇",
            "title": "千众总看并"
        },
        {
            "id": 129,
            "name": "郝涛",
            "title": "面改深气基议"
        },
        {
            "id": 130,
            "name": "黄杰",
            "title": "京命加量品认调"
        },
        {
            "id": 131,
            "name": "白平",
            "title": "因识每规率说却"
        },
        {
            "id": 132,
            "name": "蒋明",
            "title": "通统养期"
        },
        {
            "id": 133,
            "name": "邓敏",
            "title": "真商毛斗影"
        },
        {
            "id": 134,
            "name": "秦超",
            "title": "力验进低深说"
        },
        {
            "id": 135,
            "name": "袁静",
            "title": "儿较据按满做"
        },
    ]
    let total = data.length
    let url = req.url.split('?')[1]
    let pageSize = url.split('&')[0].split('=')[1]
    let pageNum = url.split('&')[1].split('=')[1]

    let current = (pageNum - 1) * pageSize

    let res = data.splice(current, pageSize)

    return {
        res,
        total
    }
})


// Mock.mock(RegExp('/getPageList' + ".*"), {
//     "list|50": [
//         {
//             "id|+1": 1,
//             name: "@cname",
//             title: "@ctitle"
//         }
//     ]
// })